import request from '@/utils/request'

// 查询预警规则列表
export function listRule(query) {
  return request({
    url: '/system/rule/list',
    method: 'get',
    params: query
  })
}

// 查询预警规则详细
export function getRule(id) {
  return request({
    url: '/system/rule/' + id,
    method: 'get'
  })
}

// 新增预警规则
export function addRule(data) {
  return request({
    url: '/system/rule',
    method: 'post',
    data: data
  })
}

// 修改预警规则
export function updateRule(data) {
  return request({
    url: '/system/rule',
    method: 'put',
    data: data
  })
}

// 删除预警规则
export function delRule(id) {
  return request({
    url: '/system/rule/' + id,
    method: 'delete'
  })
}

// 导出预警规则
export function exportRule(query) {
  return request({
    url: '/system/rule/export',
    method: 'get',
    params: query
  })
}



// 规则状态修改
export function changeEnabledState(id, enabledState) {
  const data = {
    id,
    enabledState
  }
  return request({
    url: '/system/rule/changeEnabledState',
    method: 'put',
    data: data
  })
}
